feat: add rspack plugin (#143)
This commit is contained in:
commit
c8df947e32
15
jest.config.ts
Normal file
15
jest.config.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'rspack-e2e',
|
||||
preset: '../../jest.preset.js',
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: '<rootDir>/tsconfig.spec.json',
|
||||
},
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.[tj]s$': 'ts-jest',
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||
coverageDirectory: '../../coverage/e2e/rspack-e2e',
|
||||
};
|
||||
17
project.json
Normal file
17
project.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "rspack-e2e",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"projectType": "application",
|
||||
"sourceRoot": "e2e/rspack-e2e/src",
|
||||
"targets": {
|
||||
"e2e": {
|
||||
"executor": "@nrwl/nx-plugin:e2e",
|
||||
"options": {
|
||||
"target": "rspack:build",
|
||||
"jestConfig": "e2e/rspack-e2e/jest.config.ts"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"implicitDependencies": ["rspack"]
|
||||
}
|
||||
35
tests/rspack.spec.ts
Normal file
35
tests/rspack.spec.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import {
|
||||
ensureNxProject,
|
||||
runNxCommandAsync,
|
||||
uniq,
|
||||
} from '@nrwl/nx-plugin/testing';
|
||||
|
||||
describe('rspack e2e', () => {
|
||||
// Setting up individual workspaces per
|
||||
// test can cause e2e runs to take a long time.
|
||||
// For this reason, we recommend each suite only
|
||||
// consumes 1 workspace. The tests should each operate
|
||||
// on a unique project in the workspace, such that they
|
||||
// are not dependant on one another.
|
||||
beforeAll(() => {
|
||||
ensureNxProject('@nrwl/rspack', 'dist/packages/rspack');
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
// `nx reset` kills the daemon, and performs
|
||||
// some work which can help clean up e2e leftovers
|
||||
runNxCommandAsync('reset');
|
||||
});
|
||||
|
||||
it('should create rspack project', async () => {
|
||||
const project = uniq('myapp');
|
||||
await runNxCommandAsync(
|
||||
`generate @nrwl/rspack:preset ${project} --style=css --unitTestRunner=jest --e2eTestRunner=cypress`
|
||||
);
|
||||
let result = await runNxCommandAsync(`build ${project}`);
|
||||
expect(result.stdout).toContain('Successfully ran target build');
|
||||
|
||||
result = await runNxCommandAsync(`e2e e2e`);
|
||||
expect(result.stdout).toContain('Successfully ran target e2e');
|
||||
}, 120_000);
|
||||
});
|
||||
10
tsconfig.json
Normal file
10
tsconfig.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
9
tsconfig.spec.json
Normal file
9
tsconfig.spec.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user