-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Move build related unit test into own job (#4658)
We shouldn't be asserting on built assets (dist/esm) in our unit tests.
- Loading branch information
1 parent
0b2221d
commit bc7b975
Showing
5 changed files
with
35 additions
and
25 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.js.map | ||
*.d.ts | ||
*.js | ||
!test/types/* | ||
!.eslintrc.js |
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 was deleted.
Oops, something went wrong.
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,27 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const testStrings = ['/// <reference types="node" />']; | ||
|
||
const paths = [path.join('./dist'), path.join('./esm')]; | ||
|
||
paths.forEach(dir => { | ||
if (!fs.existsSync(dir)) { | ||
// eslint-disable-next-line no-console | ||
console.error(`${dir} doesn't exist please build first`); | ||
process.exit(1); | ||
} | ||
const files = fs.readdirSync(dir); | ||
files.forEach(file => { | ||
if (file.includes('.d.ts')) { | ||
testStrings.forEach(testString => { | ||
const filePath = path.join(dir, file) | ||
if (fs.readFileSync(filePath, 'utf8').includes(testString)) { | ||
// eslint-disable-next-line no-console | ||
console.error(`${filePath} contains types`); | ||
process.exit(1); | ||
} | ||
}); | ||
} | ||
}); | ||
}); |