Skip to content

Commit 56e1bc9

Browse files
committed
test: run tests in a temporary directory
1 parent b0cd61a commit 56e1bc9

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ coverage
1515
# Logs
1616
logs
1717
*.log
18+
temp-dir
1819

1920
# Runtime data
2021
pids

lib/compilers/babel-compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var defaultBabelOptions = {
1111
}
1212

1313
module.exports = function compileBabel (scriptContent) {
14-
const { file, config } = findBabelConfig.sync(process.cwd());
14+
const { file, config } = findBabelConfig.sync(process.cwd(), 0);
1515

1616
if (!file) {
1717
logger.info('no .babelrc found, defaulting to default babel options')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"lint:fix": "npm run lint -- --fix",
2020
"release": "build/release.sh",
2121
"release:note": "node build/gen-release-note.js",
22-
"test": "npm run lint && npm run unit",
22+
"test": "npm run lint && ./test.sh",
2323
"unit": "cross-env BABEL_ENV=test jest --no-cache --coverage --coverageDirectory test/coverage --runInBand"
2424
},
2525
"author": "Edd Yerburgh",

test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rm -rf temp-dir
2+
mkdir temp-dir
3+
cp -R test temp-dir/test
4+
cp -R lib temp-dir/lib
5+
cp -R node_modules temp-dir/node_modules
6+
cp jest-vue.js temp-dir/jest-vue.js
7+
cp package.json temp-dir/package.json
8+
cp .babelrc temp-dir/.babelrc
9+
cd temp-dir
10+
yarn unit

0 commit comments

Comments
 (0)