Skip to content

Option to disable the typecheck-worker #1321

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

Closed
NullVoxPopuli opened this issue Sep 17, 2020 · 1 comment
Closed

Option to disable the typecheck-worker #1321

NullVoxPopuli opened this issue Sep 17, 2020 · 1 comment

Comments

@NullVoxPopuli
Copy link
Collaborator

Please paste the output of ember -v here

$ ember -v
ember-cli: 3.16.2
node: 12.16.3
os: linux x64

Please paste the output of tsc -v here

$ tsc -v
Version 4.0.2

Please paste the version of ember-cli-typescript and ember-cli-typescript-blueprints here

├─ [email protected]

What are instructions we can follow to reproduce the issue?

construct a node test that spawns ember-build multiple times

// node-tests/build/worker.js
const { expose } = require('threads/worker');
const { createBuilder } = require('broccoli-test-helper');

async function build() {
  let createApp = require('../../ember-cli-build'); // addon's ember-cli-build

  let app = createApp();
  let output = createBuilder(app);

  try {
    await output.build();

    return output.read();
  } finally {
    await output.dispose();
  }
}

expose({ build });
// node-tests/build/index-test.js

const assert = require('assert');
const { spawn: _spawn, Thread, Worker } = require('threads');

function spawn() {
  return _spawn(new Worker('./worker.js'));
}

describe('Acceptance | Build | index', function() {
  this.timeout(4 * 60e3);

  let thread;

  afterEach(async function() {
    if (thread) {
      await Thread.terminate(thread);
    }
  });

  it('Scenario A', async function() {
    thread = await spawn();

    let { assets: { 'vendor.js': vendorJs } } = await thread.build();

    assert.ok(true);
  });

  it('Scenario B', async function() {
    thread = await spawn();

    let { assets: { 'vendor.js': vendorJs } } = await thread.build();

    assert.ok(true);
  });
});

Using Mocha,

mocha node-tests/**/*-test.js

Obverve that the tests never exit.

(NOTE: OS may matter)

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

$ uname -a 
Linux my-vm 5.4.0-47-generic #51~18.04.1-Ubuntu SMP Sat Sep 5 14:35:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

How to fix temporarily:

In the root package.json, I added a script to delete the type-checking worker code:

    "postinstall": "> node_modules/ember-cli-typescript/js/lib/typechecking/worker/launch.js"
@dfreeman
Copy link
Member

@NullVoxPopuli I'm going to close this out since we discussed in Discord that using ember-cli-typescript without the typecheck worker doesn't make sense now that ember-cli-babel can perform typechecking directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants