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

Put Deno call in separate module so it can be mocked #9

Open
teleclimber opened this issue Dec 27, 2019 · 0 comments
Open

Put Deno call in separate module so it can be mocked #9

teleclimber opened this issue Dec 27, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@teleclimber
Copy link
Owner

It's really hard to test out the the proper functioning of our test runner. It would be help if the part where we run Deno was taken out of the test runner and put in its own module. That way we could mock it nand have the mocked Deno behave in very specific ways. That way we can test to ensure our test runner picks up on all situations.

I'm referring to this stuff, currently found in run-test.js:

check() {
		return new Promise( (resolve, reject) => {
			exec('deno --allow-all '+this.test.script, {
				cwd: path.join(this.dir, this.test.cwd)
			}, (err, stdout, stderr) => {
				if(err) {
					console.error("bad test", this.test, err);
					reject(err);
				}
				resolve();
			});
		});
	}

	exec() {
		return new Promise( (resolve, reject) => {
			const t = this.test;
			exec('deno '+t.flags+' '+t.script, {
				cwd: path.join(this.dir, t.cwd)
			}, (err, stdout, stderr) => {
				if( err && this.errIsBadTest(err.message) ) reject(err.message);
				else if( err ) resolve(err.message);
				else resolve();
			});
		});
	}
@teleclimber teleclimber added the enhancement New feature or request label Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant