diff --git a/.travis.yml b/.travis.yml index d4e4cc97..818de0d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,7 @@ install: script: - yarn lint:js + - yarn test:node # Usually, it's ok to finish the test scenario without reverting # to the addon's original dependency state, skipping "cleanup". - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup diff --git a/package.json b/package.json index d5ba0aa9..eec17329 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "broccoli-asset-rev": "^2.4.5", "broccoli-test-helper": "^1.2.0", "chai": "^4.1.2", + "co": "^4.6.0", "ember-cli": "~3.0.2", "ember-cli-dependency-checker": "^3.0.0", "ember-cli-eslint": "^4.2.1", diff --git a/test/prefer-native-test.js b/test/prefer-native-test.js index 8ca8ecd0..69e8dcc8 100644 --- a/test/prefer-native-test.js +++ b/test/prefer-native-test.js @@ -6,6 +6,7 @@ const helpers = require('broccoli-test-helper'); const vm = require('vm'); const fs = require('fs'); const RSVP = require('rsvp'); +const co = require('co'); const testCode = ` define('fetch-test', ['fetch'], function(_fetch) { @@ -29,21 +30,21 @@ require('fetch-test'); output = helpers.createBuilder(subject); }); - afterEach(async function() { - await output.dispose(); - }); + afterEach(co.wrap(function* () { + yield output.dispose(); + })); - it('preferNative is built into vendor file', async function() { - await output.build(); + it('preferNative is built into vendor file', co.wrap(function*() { + yield output.build(); let files = output.read(); expect(files).to.have.all.keys('ember-fetch.js'); expect(files['ember-fetch.js']).to.include(`var preferNative = ${preferNative}`); - }); + })); it(`${ preferNative ? 'Prefers' : "Doesn't prefer" - } native fetch as specified`, async function() { - await output.build(); + } native fetch as specified`, co.wrap(function*() { + yield output.build(); let emberFetchCode = output.read()['ember-fetch.js']; const amdLoaderCode = fs.readFileSync(require.resolve('loader.js')); const sandbox = { @@ -59,11 +60,11 @@ require('fetch-test'); const code = amdLoaderCode + emberFetchCode + testCode; vm.runInContext(code, sandbox); expect(sandbox.__result).to.equal(preferNative); - }); + })); if (preferNative === true) { - it('Has fetch poly fill even if fetch is not there', async function() { - await output.build(); + it('Has fetch poly fill even if fetch is not there', co.wrap(function*() { + yield output.build(); let emberFetchCode = output.read()['ember-fetch.js']; const amdLoaderCode = fs.readFileSync(require.resolve('loader.js')); const sandbox = { @@ -87,7 +88,7 @@ require('fetch-test'); const code = amdLoaderCode + emberFetchCode + testCodeForNonFetch; vm.runInContext(code, sandbox); expect(sandbox.window.__result).to.equal(true); - }) + })) } }); });