Skip to content

Commit

Permalink
chore: start moving e2e tests to Jest + execa-wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Apr 6, 2018
1 parent 02c318a commit da2dfdf
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 52 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"semver": "5.5.0"
},
"devDependencies": {
"execa-wrap": "1.3.0",
"git-issues": "1.3.1",
"github-post-release": "1.13.1",
"grunt": "0.4.5",
Expand Down Expand Up @@ -61,8 +62,7 @@
"test": "npm run itself && npm run unit && npm run e2e",
"itself": "node index.js",
"unit": "jest",
"e2e": "gt test/*.coffee --output",
"e2e": "jest 'test/parent.test.js'",
"e2e": "jest 'test/e2e.test.js'",
"commit": "git-issues && commit-wizard",
"issues": "git-issues",
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
Expand Down
50 changes: 0 additions & 50 deletions test/e2e.coffee

This file was deleted.

62 changes: 62 additions & 0 deletions test/e2e.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const join = require('path').join
const relative = join.bind(null, __dirname)
const check = require('..')
const ERROR_EXIT_CODE = 255
const execaWrap = require('execa-wrap')

describe.only('e2e NPM tests in root folder', () => {
beforeEach(() => {
process.chdir(relative('..'))
})

afterEach(() => {
process.chdir(__dirname)
})

it('test itself', () => {
const options = {
filter: 'code'
}
return execaWrap('node', ['bin/deps-ok.js', '--verbose'], options)
.then(output => output.trim())
.then(output => {
expect(output).toBe("code: 0")
})
})
})

// gt.module 'e2e NPM tests in this folder'

// args = ['../bin/deps-ok.js', '--verbose', '--filename']

// gt.async 'test itself with folder', ->
// gt.exec 'node', args.concat(relative('..')), 0,
// 'this module has all dependencies'

// gt.async 'test itself with package.json path', ->
// gt.exec 'node', args.concat(relative('../package.json')), 0,
// 'this module has all dependencies'

// gt.async 'test version with latest keyword', ->
// gt.exec 'node', args.concat(relative('./package-with-latest.json')), ERROR_EXIT_CODE,
// 'this has some missing dependencies'

// gt.async 'test version with github version', ->
// gt.exec 'node', args.concat(relative('./package-with-github.json')), 0,
// 'this handles github: version string'

// gt.async 'test version with local file path', ->
// gt.exec 'node', args.concat(relative('./package-with-file.json')), 0,
// 'this handles file: version string'

// gt.async 'test version with url', ->
// gt.exec 'node', args.concat(relative('./package-with-url.json')), 0,
// 'this handles url string'

// gt.async 'test non-existing file', ->
// gt.exec 'node', args.concat(relative('./does-not-exist.json')), ERROR_EXIT_CODE,
// 'package file does not exist'

// gt.async 'package is missing version property', ->
// gt.exec 'node', args.concat(relative('./package-without-version.json')), ERROR_EXIT_CODE,
// 'this has some missing dependencies'

0 comments on commit da2dfdf

Please sign in to comment.