Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app-compiler: Remove unnecessary co dependency #82

Merged
merged 1 commit into from
Nov 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/@glimmer/app-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
"devDependencies": {
"broccoli-stew": "^1.5.0",
"broccoli-test-helper": "^1.2.0",
"co": "^4.6.0"
"broccoli-test-helper": "^1.2.0"
}
}
}
47 changes: 23 additions & 24 deletions packages/@glimmer/app-compiler/test/node/bundle-compiler-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { module, test } from 'qunitjs';
import { GlimmerBundleCompiler } from '@glimmer/app-compiler';
import { createTempDir, buildOutput } from 'broccoli-test-helper';
import co from 'co';
import { MUCompilerDelegate } from '@glimmer/compiler-delegates';

class TestModuleUnificationDelegate extends MUCompilerDelegate {
Expand Down Expand Up @@ -33,7 +32,7 @@ module('Broccol Glimmer Bundle Compiler', function(hooks) {
}, /Must supply a projectPath/);
});

test('syncs forward all files', co.wrap(function *(assert) {
test('syncs forward all files', async function(assert) {
input.write({
'my-app': {
'package.json': JSON.stringify({name: 'my-app'}),
Expand Down Expand Up @@ -74,20 +73,20 @@ module('Broccol Glimmer Bundle Compiler', function(hooks) {
}
});

let output = yield buildOutput(compiler);
let output = await buildOutput(compiler);
let files = output.read();

assert.deepEqual(Object.keys(files), ['my-app']);
assert.deepEqual(Object.keys(files['my-app']).sort(), ['src', 'package.json', 'templates.gbx', 'data.js'].sort());
assert.deepEqual(Object.keys(files['my-app'].src).sort(), ['ui'].sort());
assert.deepEqual(Object.keys(files['my-app'].src.ui), ['components']);
assert.deepEqual(Object.keys(files['my-app']['src']).sort(), ['ui'].sort());
assert.deepEqual(Object.keys(files['my-app']['src'].ui), ['components']);

Object.keys(files['my-app'].src.ui.components).forEach((component) => {
assert.deepEqual(Object.keys(files['my-app'].src.ui.components[component]), ['component.ts']);
Object.keys(files['my-app']['src'].ui.components).forEach((component) => {
assert.deepEqual(Object.keys(files['my-app']['src'].ui.components[component]), ['component.ts']);
});
}));
});

test('[MU] compiles the gbx and data segment', co.wrap(function *(assert) {
test('[MU] compiles the gbx and data segment', async function(assert) {
input.write({
'my-app': {
'package.json': JSON.stringify({name: 'my-app'}),
Expand Down Expand Up @@ -124,15 +123,15 @@ module('Broccol Glimmer Bundle Compiler', function(hooks) {
}
});

let output = yield buildOutput(compiler);
let output = await buildOutput(compiler);
let files = output.read();

let buffer = new Uint16Array(files['my-app'].src['templates.gbx']);
let buffer = new Uint16Array(files['my-app']['src']['templates.gbx']);

assert.ok(buffer, 'Buffer is aligned');
}));
});

test('data segment has all segments', co.wrap(function *(assert) {
test('data segment has all segments', async function(assert) {
input.write({
'my-app': {
'package.json': JSON.stringify({name: 'my-app'}),
Expand Down Expand Up @@ -169,18 +168,18 @@ module('Broccol Glimmer Bundle Compiler', function(hooks) {
}
});

let output = yield buildOutput(compiler);
let output = await buildOutput(compiler);
let files = output.read();
let dataSegment = files['my-app'].src['data.js'];
let dataSegment = files['my-app']['src']['data.js'];
assert.ok(dataSegment.length > 0, 'data segment is populated');
assert.ok(dataSegment.indexOf('table') > -1, 'has a table');
assert.ok(dataSegment.indexOf('heap') > -1, 'has a heap');
assert.ok(dataSegment.indexOf('symbols') > -1, 'has symbol tables');
assert.ok(dataSegment.indexOf('pool') > -1, 'has a constant pool');
assert.ok(dataSegment.indexOf('map') > -1, 'has a specifier map');
}));
});

test('can lookup builtins', co.wrap(function *(assert) {
test('can lookup builtins', async function(assert) {
input.write({
'my-app': {
'package.json': JSON.stringify({name: 'my-app'}),
Expand All @@ -205,13 +204,13 @@ module('Broccol Glimmer Bundle Compiler', function(hooks) {
}
});

let output = yield buildOutput(compiler);
let output = await buildOutput(compiler);
let files = output.read();
let dataSegment = files['my-app'].src['data.js'];
let dataSegment = files['my-app']['src']['data.js'];
assert.ok(dataSegment.indexOf('import { ifHelper as ') > -1);
}));
});

test('can lookup custom builtins', co.wrap(function *(assert) {
test('can lookup custom builtins', async function(assert) {
input.write({
'my-app': {
'package.json': JSON.stringify({name: 'my-app'}),
Expand Down Expand Up @@ -244,13 +243,13 @@ module('Broccol Glimmer Bundle Compiler', function(hooks) {
}
});

let output = yield buildOutput(compiler);
let output = await buildOutput(compiler);
let files = output.read();
let dataSegment = files['my-app'].src['data.js'];
let dataSegment = files['my-app']['src']['data.js'];
assert.ok(dataSegment.split('@css-block/helpers/state').length === 2);
assert.ok(dataSegment.indexOf('@css-block/helpers/state') > -1);
assert.ok(dataSegment.indexOf('@css-block/helpers/style-if') > -1);
assert.ok(dataSegment.indexOf('@css-block/helpers/style-concat') === -1);
}));
});

});