Skip to content

Commit

Permalink
Merge pull request #2622 from snyk/chore/jest-config
Browse files Browse the repository at this point in the history
chore: use jest projects
  • Loading branch information
Jahed Ahmed committed Jan 25, 2022
2 parents 577fce6 + 2900259 commit 79dcc6a
Show file tree
Hide file tree
Showing 31 changed files with 1,510 additions and 2,195 deletions.
33 changes: 3 additions & 30 deletions .circleci/config.yml
Expand Up @@ -250,24 +250,9 @@ jobs:
- run:
name: Configuring Snyk CLI
command: node ./bin/snyk config set "api=$env:SNYK_API_KEY"
- run:
name: Running packages unit tests
command: npm run test:packages-unit -- --ci
- run:
name: Running packages acceptance tests
command: npm run test:packages-acceptance -- --ci
- run:
name: Running root tests
command: npm run test:jest -- --ci
- run:
name: Running unit tests
command: npm run test:jest-unit -- --ci
- run:
name: Running system tests
command: npm run test:jest-system -- --ci
- run:
name: Running acceptance tests
command: npm run test:jest-acceptance -- --ci
command: npm run test:acceptance
test-linux:
<<: *defaults
docker:
Expand All @@ -288,26 +273,14 @@ jobs:
- run:
name: Configuring Snyk CLI
command: node ./bin/snyk config set "api=${SNYK_API_KEY}"
- run:
name: Running packages unit tests
command: npm run test:packages-unit -- --ci
- run:
name: Running packages acceptance tests
command: npm run test:packages-acceptance -- --ci
- run:
name: Running root tests
command: npm run test:jest -- --ci
- run:
name: Running unit tests
command: npm run test:jest-unit -- --ci
- run:
name: Running system tests
command: npm run test:jest-system -- --ci
command: npm run test:unit
- aws-cli/install:
version: << parameters.aws_version >>
- run:
name: Running acceptance tests
command: npm run test:jest-acceptance -- --ci
command: npm run test:acceptance

test-tap:
<<: *defaults
Expand Down
2 changes: 0 additions & 2 deletions check-dependencies.config.ts
Expand Up @@ -4,8 +4,6 @@ export const config: Options = {
ignoreMatches: [
'sarif', // we only use @types/sarif. https://github.com/depcheck/depcheck/issues/640
'@types/jest', // jest is a global so impossible to detect usage of types
'jest-junit', // used in circleci
'tap-junit', // used in circleci
'lerna', // used in circleci
'ts-loader', // used by webpack
'node-loader', // used by webpack
Expand Down
2 changes: 1 addition & 1 deletion dangerfile.js
Expand Up @@ -65,7 +65,7 @@ if (danger.github && danger.github.pr) {

if (newTestFiles.length) {
const joinedFileList = newTestFiles.map((f) => '- `' + f + '`').join('\n');
const msg = `Looks like you added a new Tap test. Consider making it a Jest test instead. See files in \`test/jest/(unit|system|acceptance)\` for examples. Files found:\n${joinedFileList}`;
const msg = `Looks like you added a new Tap test. Consider making it a Jest test instead. See files in \`test/jest/(unit|acceptance)\` for examples. Files found:\n${joinedFileList}`;
warn(msg);
}

Expand Down
23 changes: 6 additions & 17 deletions jest.config.js
@@ -1,17 +1,6 @@
module.exports = {
preset: 'ts-jest',
testMatch: [
'<rootDir>/test/*.spec.ts',
'<rootDir>/test/iac-unit-tests/*.spec.ts',
'<rootDir>/packages/**/test/**/*.spec.ts',
'<rootDir>/test/jest/unit/**/*.spec.ts',
'<rootDir>/test/jest/system/**/*.spec.ts',
'<rootDir>/test/jest/acceptance/**/*.spec.ts',
],
modulePathIgnorePatterns: [
'<rootDir>/test/.*fixtures/*',
'<rootDir>/packages/.+/test/.*fixtures/*',
'<rootDir>/test/acceptance/*',
'<rootDir>/test/acceptance/workspaces/*', // to avoid `jest-haste-map: Haste module naming collision` errors
],
};
const { createJestConfig } = require('./test/createJestConfig');

module.exports = createJestConfig({
displayName: 'snyk',
projects: ['<rootDir>', '<rootDir>/packages/*'],
});

0 comments on commit 79dcc6a

Please sign in to comment.