forked from ipfs/aegir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-env mocha */ | ||
|
||
import { createRequire } from 'module' | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
import { execa } from 'execa' | ||
import { expect } from '../utils/chai.js' | ||
|
||
const require = createRequire(import.meta.url) | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
const bin = require.resolve('../src/index.js') | ||
|
||
describe('document check', () => { | ||
it('should fail for errant typescript in docs', async () => { | ||
const cwd = path.join(__dirname, 'fixtures/document-check/ts-fail') | ||
|
||
await expect(execa(bin, ['doc-check', '--inputFiles', `${cwd}/*.md`, '--tsConfigPath', `${cwd}`])) | ||
.to.eventually.be.rejected() | ||
.with.property('stdout') | ||
.that.include('Error compiling example code block 1') | ||
}) | ||
|
||
it('should pass for correct typescript in docs', async () => { | ||
const cwd = path.join(__dirname, 'fixtures/document-check/pass') | ||
|
||
await expect(execa(bin, ['doc-check', '--inputFiles', `${cwd}/*.md`])).to.eventually.be.fulfilled() | ||
}) | ||
|
||
it('should fail for missing tsconfig.json', async () => { | ||
const cwd = path.join(__dirname, 'fixtures/document-check/tsconfig-fail') | ||
|
||
await expect(execa(bin, ['doc-check', '--inputFiles', `${cwd}/*.md`, '--tsConfigPath', `${cwd}`])) | ||
.to.eventually.be.rejected() | ||
.with.property('stderr') | ||
.that.include('no such file or directory') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```ts | ||
export const a = 1; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "./../../../../src/config/tsconfig.aegir.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"emitDeclarationOnly": true, | ||
"isolatedModules": true | ||
}, | ||
"include": [ | ||
"package.json", | ||
"src", | ||
"test", | ||
"utils" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```typescript | ||
still.bad.code | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```typescript | ||
wrong.code() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "./../../../../src/config/tsconfig.aegir.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": [ | ||
"package.json", | ||
"src", | ||
"test", | ||
"utils" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```ts | ||
export const a = 1; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters