Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davewasmer committed Feb 8, 2018
1 parent 1b21f03 commit 2fc08e6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class Project {
const Broccoli = require('broccoli').Builder;
let broccoli = new Broccoli(tree);
let results = await broccoli.build();
await this.finishBuild(results, destDir);
this.finishBuild(results, destDir);
debug('project build finished');
spinner.succeed(`${ this.pkg.name } build complete (${ timer.stop() }s)`);
} catch (err) {
Expand Down
8 changes: 4 additions & 4 deletions lib/spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function flushQueue() {
childChannel.ref();
try {
childSpinner.send(nextOperation);
} catch(e) {
} catch (e) {
// most likely the child process is dead because it
// received the sigint while this process was blocked
// on some build step - we're likely about to shut
Expand All @@ -89,9 +89,9 @@ export function wrapOutputStream(stream: Writable) {
if (spinnerIsActive) {
readline.clearLine(mockOriginalStream, 0);
readline.cursorTo(mockOriginalStream, 0);
chunk = chunk.toString();
if (!chunk.endsWith('\n')) {
chunk = chunk + '\n';
let chunkStr = chunk.toString();
if (!chunkStr.endsWith('\n')) {
chunkStr = `${ chunkStr }\n`;
}
}
return originalWrite(chunk, encoding, callback);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/globify.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function globify(dirs: string[]) {
return dirs.map((dir) => `${ dir }/**/*`);
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "denali-cli",
"version": "0.0.20",
"description": "The official CLI for starting, building, and running Denali apps and addons",
"description": "The official CLI for creating, building, and running Denali apps and addons",
"homepage": "http://denali.js.org",
"repository": "denali-js/denali-cli",
"author": {
"name": "Dave Wasmer",
"email": "davewasmer@gmail.com",
"url": "davewasmer.com"
"url": "http://davewasmer.com"
},
"bin": {
"denali": "dist/bin/denali"
},
"main": "dist/lib/index.js",
"engines": {
"node": ">=7"
"node": ">=7.6"
},
"files": [
"dist"
Expand All @@ -41,7 +41,7 @@
"build:bin": "mv dist/bin/denali.js dist/bin/denali && chmod +x dist/bin/denali",
"build:templates": "cp -r lib/templates dist/lib/templates",
"prepublishOnly": "npm run build",
"lint": "! tslint --project tsconfig.json -c tslint.json --type-check | sed \"s|$PWD/||\" | grep ERROR",
"lint": "! tslint --project tsconfig.json -c tslint.json | sed \"s|$PWD/||\" | grep ERROR",
"test": "npm run lint && npm run build && nyc ava dist/test/acceptance"
},
"license": "MIT",
Expand Down
14 changes: 11 additions & 3 deletions test/acceptance/commands/addon-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@ import test from 'ava';
import { each } from 'lodash';
import * as path from 'path';
import * as fs from 'fs-extra';
import * as tmp from 'tmp';
import CliAcceptanceTest from '../../utils/cli-acceptance';

test('generates an addon', async (t) => {
let addonCommand = new CliAcceptanceTest('addon denali-new-addon', { populateWithDummy: false, name: 'new-command' });
let addonCommand = new CliAcceptanceTest('addon denali-new-addon', {
populateWithDummy: false,
name: 'addon-command',
dir: tmp.dirSync({
unsafeCleanup: true,
prefix: `addon-command`
}).name
});
await addonCommand.run({ failOnStderr: true });

let filesToCheck = {
'app/addon.js': 'addon main file',
'.gitignore': '.gitignore',
'test/dummy/app/application.js': 'dummy app file'
};

await addonCommand.run({ failOnStderr: true });
each(filesToCheck, (description, file) => {
let pathToCheck = path.join(addonCommand.dir, 'denali-new-addon', file);
t.true(fs.existsSync(pathToCheck), `${ description } should be generated`);
Expand Down
16 changes: 12 additions & 4 deletions test/acceptance/commands/new-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
import test from 'ava';
import * as path from 'path';
import * as fs from 'fs-extra';
import * as tmp from 'tmp';
import CliAcceptanceTest from '../../utils/cli-acceptance';

test('generates an app', async (t) => {
let newCommand = new CliAcceptanceTest('new my-denali-app', { populateWithDummy: false, name: 'new-command' });
let generatedFilepath = path.join(newCommand.dir, 'my-denali-app', 'app', 'application.js');
let gitignorePath = path.join(newCommand.dir, 'my-denali-app', '.gitignore');

let newCommand = new CliAcceptanceTest('new my-denali-app', {
populateWithDummy: false,
name: 'new-command',
dir: tmp.dirSync({
unsafeCleanup: true,
prefix: `new-command`
}).name
});
await newCommand.run({ failOnStderr: true });

let generatedFilepath = path.join(newCommand.dir, 'my-denali-app', 'app', 'application.js');
t.true(fs.existsSync(generatedFilepath), 'file should be generated');
let gitignorePath = path.join(newCommand.dir, 'my-denali-app', '.gitignore');
t.true(fs.existsSync(gitignorePath), 'gitignore should be generated');
});
3 changes: 0 additions & 3 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"arrow-return-shorthand": true,
"class-name": true,
"comment-format": [ true, "check-space" ],
"completed-docs": [ true, "classes", "functions", "methods", "properties" ],
"curly": true,
"eofline": true,
"import-spacing": true,
Expand All @@ -32,7 +31,6 @@
"no-empty-interface": true,
"no-empty": true,
"no-eval": true,
"no-floating-promises": true,
"no-for-in-array": true,
"no-inferrable-types": [ true, "ignore-params" ],
"no-internal-module": true,
Expand Down Expand Up @@ -77,7 +75,6 @@
"variable-declaration": "onespace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"use-isnan": true,
"whitespace": [ true, "check-branch", "check-decl", "check-operator", "check-module", "check-separator", "check-type" ]
Expand Down

0 comments on commit 2fc08e6

Please sign in to comment.