-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from tzemanovic/elm-app-create-fix
fix(bin/elm-app): pass the correct argument to `elm-app create` command
- Loading branch information
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const path = require('path'); | ||
const expect = require('unexpected'); | ||
const spawn = require('cross-spawn'); | ||
const dircompare = require('dir-compare'); | ||
const fs = require('fs'); | ||
const rimraf = require('rimraf'); | ||
|
||
const testAppName = 'test-app-eject'; | ||
const rootDir = path.resolve(__dirname, '..'); | ||
const testAppDir = path.join(rootDir, testAppName); | ||
const elmAppCmd = path.join(rootDir, 'bin/elm-app-cli.js'); | ||
|
||
describe('Create Elm application with `elm-app create` command', () => { | ||
after(() => { | ||
rimraf.sync(testAppDir); | ||
}); | ||
|
||
it(`'elm-app create ${testAppName}' should succeed`, () => { | ||
const { status } = spawn.sync('node', [elmAppCmd, 'create', testAppName]); | ||
expect(status, 'to be', 0); | ||
}).timeout(60 * 1000); | ||
|
||
it(`'${testAppName}' should have elm.json file`, () => { | ||
expect(fs.existsSync(path.join(testAppDir, 'elm.json')), 'to be', true); | ||
}); | ||
|
||
it(`'${testAppName}' should have .gitignore file`, () => { | ||
expect(fs.existsSync(path.join(testAppDir, '.gitignore')), 'to be', true); | ||
}); | ||
|
||
it(`'${testAppName}' should have the same file structure as template`, () => { | ||
const templateDir = path.join(rootDir, 'template'); | ||
const options = { | ||
excludeFilter: 'elm-stuff, elm.json, gitignore, .gitignore, build' | ||
}; | ||
const { same } = dircompare.compareSync(templateDir, testAppDir, options); | ||
expect(same, 'to be', true); | ||
}); | ||
}); |