Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let fs;
- let globby;
- try {
- fs = require('fs-extra');
- globby = require('globby');
- } catch (error) {
- console.log(
- 'Could not load required modules. Please run `npm install` and run again.',
- );
- console.log(error.stack);
- console.log();
- process.exit(1);
- }
- const moveFile = (from, to) => {
- console.log(`Moving: ${from} -> ${to}`);
- fs.moveSync(from, to);
- };
- try {
- const e2eTestFilePaths = globby.sync('test/{e2e,server}/**/*.spec.[j|t]s', {
- dot: true,
- gitignore: true,
- });
- // We removed the `server` environment, these tests are now e2e
- e2eTestFilePaths.map(file => moveFile(file, file.replace('.spec.', '.e2e.')));
- // Move JS setup files to new format
- if (fs.pathExistsSync('test/setup.e2e.js')) {
- moveFile('test/setup.e2e.js', 'test/e2e-setup.js');
- }
- if (fs.pathExistsSync('test/setup.component.js')) {
- moveFile('test/setup.component.js', 'test/spec-setup.js');
- }
- // Move TS setup files to new format
- if (fs.pathExistsSync('test/setup.e2e.ts')) {
- moveFile('test/setup.e2e.ts', 'test/e2e-setup.ts');
- }
- if (fs.pathExistsSync('test/setup.component.ts')) {
- moveFile('test/setup.component.ts', 'test/spec-setup.ts');
- }
- // Warn if a server setup script exist: it should be merged with the one from e2e tests
- if (
- fs.pathExistsSync('test/setup.server.js') ||
- fs.pathExistsSync('test/setup.server.ts')
- ) {
- console.log(
- 'You have a "test/setup.server.[j|t]s" in your project. Please remove it and move its content to "test/e2e-setup.[j|t]s"',
- );
- }
- } catch (error) {
- console.log('Failed migrating project.');
- console.log(error.stack);
- console.log();
- process.exit(1);
- }
- console.log('Project migrated successfully.');
- console.log();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement