Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 3cd67c7

Browse files
committed
test(optimization): make tests platform independent
make tests platform independent
1 parent 808b153 commit 3cd67c7

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/optimization.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('optimization task', () => {
3333

3434
describe('purgeGeneratedFiles', () => {
3535
it('should remove files in buildDir with suffix from the cache', () => {
36-
const buildDir = '/some/fake/dir/myApp/www/build';
36+
const buildDir = join(process.cwd(), 'some', 'fake', 'dir', 'myApp', 'www', 'build');
3737
const context = {
3838
fileCache: new FileCache(),
3939
buildDir: buildDir
@@ -43,9 +43,9 @@ describe('optimization task', () => {
4343
const filePathTwo = join(buildDir, `1.${suffix}`);
4444
const filePathThree = join(buildDir, `main.js`);
4545
const filePathFour = join(buildDir, `main.css`);
46-
const filePathFive = join('some', 'fake', 'dir', 'myApp', 'src', `app.ts`);
47-
const filePathSix = join('some', 'fake', 'dir', 'myApp', 'src', `app.js`);
48-
const filePathSeven = join('some', 'fake', 'dir', 'myApp', 'src', 'pages', `1.${suffix}`);
46+
const filePathFive = join(process.cwd(), 'some', 'fake', 'dir', 'myApp', 'src', `app.ts`);
47+
const filePathSix = join(process.cwd(), 'some', 'fake', 'dir', 'myApp', 'src', `app.js`);
48+
const filePathSeven = join(process.cwd(), 'some', 'fake', 'dir', 'myApp', 'src', 'pages', `1.${suffix}`);
4949
context.fileCache.set(filePathOne, { path: filePathOne, content: filePathOne});
5050
context.fileCache.set(filePathTwo, { path: filePathTwo, content: filePathTwo});
5151
context.fileCache.set(filePathThree, { path: filePathThree, content: filePathThree});

src/optimization/treeshake.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ export const AppModuleNgFactory = new import0.NgModuleFactory(AppModuleInjector,
12351235
beforeEach(() => {
12361236
originalEnv = process.env;
12371237
let env: any = { };
1238-
env[Constants.ENV_VAR_IONIC_ANGULAR_DIR] = '/Users/noone/Dev/myApp3/node_modules/ionic-angular';
1238+
env[Constants.ENV_VAR_IONIC_ANGULAR_DIR] = join(process.cwd(), 'myApp', 'node_modules', 'ionic-angular');
12391239
process.env = env;
12401240
});
12411241

@@ -1928,9 +1928,10 @@ export const AppModuleNgFactory = new import0.NgModuleFactory(AppModuleInjector,
19281928
//# sourceMappingURL=app.module.ngfactory.js.map
19291929
`;
19301930

1931-
const nodeModulesPath = '/Users/noone/Dev/myApp3/node_modules';
1931+
const baseDir = join(process.cwd(), 'myApp');
1932+
const nodeModulesPath = join(baseDir, 'node_modules');
19321933

1933-
const appModuleNgFactoryPath = `/Users/noone/Dev/myApp3/src/app/app.module.ngfactory.js`;
1934+
const appModuleNgFactoryPath = join(baseDir, 'src', 'app', 'app.module.ngfactory.js');
19341935
const controllerPath = join(nodeModulesPath, 'ionic-angular', 'components', 'action-sheet', 'action-sheet-controller.js');
19351936
const controllerPath2 = join(nodeModulesPath, 'ionic-angular', 'components', 'alert', 'alert-controller.js');
19361937

0 commit comments

Comments
 (0)