@@ -5,8 +5,10 @@ const fs = require('fs-extra');
55const cp = require ( 'child_process' ) ;
66const tmp = require ( 'tmp' ) ;
77
8- const inputFile = path . join ( process . cwd ( ) , '__testfixtures__/final-boss.input.js' ) ;
9- const outputFile = path . join ( process . cwd ( ) , '__testfixtures__/final-boss.output.js' ) ;
8+ const originalCwd = process . cwd ( ) ;
9+
10+ const inputFile = path . join ( originalCwd , '__testfixtures__/final-boss.input.js' ) ;
11+ const outputFile = path . join ( originalCwd , '__testfixtures__/final-boss.output.js' ) ;
1012
1113let tmpPath ;
1214
@@ -16,7 +18,7 @@ function run() {
1618
1719 return new Promise ( resolve => {
1820 let ps = cp . spawn ( 'node' , [
19- path . join ( process . cwd ( ) , 'bin/ember-modules-codemod' )
21+ path . join ( originalCwd , 'bin/ember-modules-codemod' )
2022 ] , {
2123 cwd : tmpPath
2224 } ) ;
@@ -45,7 +47,13 @@ describe('bin acceptance', function() {
4547 beforeEach ( function ( ) {
4648 tmpPath = tmp . dirSync ( ) . name ;
4749
48- tmpPackageJson = path . join ( tmpPath , 'package.json' ) ;
50+ process . chdir ( tmpPath ) ;
51+
52+ tmpPackageJson = path . join ( process . cwd ( ) , 'package.json' ) ;
53+ } ) ;
54+
55+ afterAll ( function ( ) {
56+ process . chdir ( originalCwd ) ;
4957 } ) ;
5058
5159 it ( 'handles non-ember projects' , function ( ) {
@@ -94,7 +102,7 @@ describe('bin acceptance', function() {
94102 tmpFile = path . join ( tmpPath , 'app/final-boss.js' ) ;
95103
96104 fs . copySync (
97- path . join ( process . cwd ( ) , '__testfixtures__/final-boss.input.js' ) ,
105+ path . join ( originalCwd , '__testfixtures__/final-boss.input.js' ) ,
98106 tmpFile
99107 ) ;
100108 } ) ;
0 commit comments