Skip to content

Commit

Permalink
Fix Tests (#648)
Browse files Browse the repository at this point in the history
* fix `template/default` snapshot

* fix: remove `babelrc` files during `test.create`
  • Loading branch information
lukeed authored Sep 15, 2018
1 parent 90a2a20 commit 4f25dd5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/cli/tests/images/create.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const path = require('path');

exports.default = [
// '.babelrc',
'.gitignore',
'package.json',
'README.md',
'src/.babelrc',
'src/assets/favicon.ico',
'src/assets/icons/android-chrome-192x192.png',
'src/assets/icons/android-chrome-512x512.png',
Expand All @@ -22,8 +22,8 @@ exports.default = [
'src/routes/profile/index.js',
'src/routes/profile/style.css',
'src/style/index.css',
'src/tests/__mocks__/browserMocks.js',
'src/tests/__mocks__/fileMocks.js',
'src/tests/header.test.js'
'tests/__mocks__/browserMocks.js',
'tests/__mocks__/fileMocks.js',
'tests/header.test.js'
].map(s => s.replace(/\//g, path.sep));

11 changes: 10 additions & 1 deletion packages/cli/tests/lib/cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const mkdirp = require('mkdirp');
const { join } = require('path');
const { existsSync, unlinkSync } = require('fs');
const cmd = require('../../lib/commands');
const { tmpDir } = require('./output');
const mkdirp = require('mkdirp');

const argv = {
_: [],
Expand All @@ -14,7 +15,15 @@ const argv = {
exports.create = async function (template, name) {
let dest = tmpDir();
name = name || `test-${template}`;

await cmd.create(template, dest, { name, cwd:'.' });

// TODO: temporary – will resolve after 2.x->3.x release
// Templates are using 2.x, which needs `.babelrc` for TEST modification.
// The 3.x templates won't need `.babelrc` for { modules: commonjs }
let babelrc = join(dest, '.babelrc');
existsSync(babelrc) && unlinkSync(babelrc);

return dest;
};

Expand Down

0 comments on commit 4f25dd5

Please sign in to comment.