-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(testing): add lerna-smoke-tests
- Loading branch information
1 parent
abfa864
commit 3952d8f
Showing
6 changed files
with
227 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
export default { | ||
transform: { | ||
'^.+\\.[tj]sx?$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], | ||
maxWorkers: 1, | ||
globals: { 'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json' } }, | ||
displayName: 'e2e-lerna-smoke-tests', | ||
preset: '../../jest.preset.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "e2e-lerna-smoke-tests", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "e2e/lerna-smoke-tests", | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": {}, | ||
"run-e2e-tests": {} | ||
}, | ||
"implicitDependencies": ["nx", "devkit"] | ||
} |
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,58 @@ | ||
import { | ||
cleanupProject, | ||
newLernaWorkspace, | ||
runLernaCLI, | ||
updateJson, | ||
} from '@nrwl/e2e/utils'; | ||
|
||
/** | ||
* These minimal smoke tests are here to ensure that we do not break assumptions on the lerna side | ||
* when making updates to nx or @nrwl/devkit. | ||
*/ | ||
describe('Lerna Smoke Tests', () => { | ||
beforeAll(() => newLernaWorkspace()); | ||
afterAll(() => cleanupProject()); | ||
|
||
// `lerna repair` builds on top of `nx repair` and runs all of its generators | ||
describe('lerna repair', () => { | ||
// If this snapshot fails it means that nx repair generators are making assumptions which don't hold true for lerna workspaces | ||
it('should complete successfully on a new lerna workspace', async () => { | ||
expect(runLernaCLI(`repair`)).toMatchInlineSnapshot(` | ||
" | ||
> Lerna No changes were necessary. This workspace is up to date! | ||
" | ||
`); | ||
}, 1000000); | ||
}); | ||
|
||
// `lerna run` delegates to the nx task runner behind the scenes | ||
describe('lerna run', () => { | ||
it('should complete successfully on a new lerna workspace', async () => { | ||
runLernaCLI('create package-1 -y'); | ||
updateJson('packages/package-1/package.json', (json) => ({ | ||
...json, | ||
scripts: { | ||
...(json.scripts || {}), | ||
'print-name': 'echo test-package-1', | ||
}, | ||
})); | ||
|
||
expect(runLernaCLI(`run print-name`)).toMatchInlineSnapshot(` | ||
" | ||
> package-1:print-name | ||
> package-1@0.0.0 print-name | ||
> echo test-package-1 | ||
test-package-1 | ||
> Lerna (powered by Nx) Successfully ran target print-name for project package-1 | ||
" | ||
`); | ||
}, 1000000); | ||
}); | ||
}); |
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": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"types": ["node", "jest"] | ||
}, | ||
"include": [], | ||
"files": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
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,20 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": [ | ||
"**/*.test.ts", | ||
"**/*.spec.ts", | ||
"**/*.spec.tsx", | ||
"**/*.test.tsx", | ||
"**/*.spec.js", | ||
"**/*.test.js", | ||
"**/*.spec.jsx", | ||
"**/*.test.jsx", | ||
"**/*.d.ts", | ||
"jest.config.ts" | ||
] | ||
} |
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