Skip to content

Commit

Permalink
support running e2e tests in a dev environment where bit command is… (
Browse files Browse the repository at this point in the history
#170)

* support running e2e tests in a dev environment where `bit` command is different (such as bit-dev)

* e2e: make sure the bit-javascript driver is the one used in bit-bin and not an outdated one
  • Loading branch information
davidfirst authored and GiladShoham committed Jun 6, 2017
1 parent d3432fb commit f4a6a25
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

- support running e2e tests in a dev environment where `bit` command is different (such as bit-dev)
- `bit import` no longer uses the internal cache objects to retrieve remote bit-components.
- avoid corrupted data in a scope when dependencies somehow are not being resolved.
- allow `bit init` when there is a bit.json file without the `source` or `env` attributes.
Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ npm install -g flow-bin flow-typed
npm test
```

- run the e2e tests
- run the e2e tests (with default 'bit' command)
```bash
npm run e2e-test
```

- run e2e tests using bit-dev command
```bash
npm run e2e-test --bit_bin=bit-dev
```

### lint

- run eslint
Expand Down
2 changes: 2 additions & 0 deletions e2e/e2e-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ export default class Helper {
this.e2eDir = path.join(os.tmpdir(), 'bit', 'e2e');
this.localScopePath = path.join(this.e2eDir, this.localScope);
this.remoteScopePath = path.join(this.e2eDir, this.remoteScope);
this.bitBin = process.env.npm_config_bit_bin || 'bit'; // e.g. npm run e2e-test --bit_bin=bit-dev
}

runCmd(cmd, cwd = this.localScopePath) {
if (cmd.startsWith('bit ')) cmd = cmd.replace('bit', this.bitBin);
if (this.verbose) console.log('running: ', cmd); // eslint-disable-line
const cmdOutput = childProcess.execSync(cmd, { cwd });
if (this.verbose) console.log(cmdOutput.toString()); // eslint-disable-line
Expand Down
7 changes: 5 additions & 2 deletions e2e/hooks/javascript-hooks.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ function expectLinksInRootLevel() {
describe('javascript-hooks', function () {
this.timeout(0);
before(() => {
helper.runCmd('npm init -y', helper.e2eDir);
helper.runCmd('npm install bit-javascript', helper.e2eDir);
// makes sure the bit-javascript driver is the one used in bit-bin and not an outdated one
const bitJavascriptPath = fs.realpathSync(path.join(process.cwd(), 'node_modules', 'bit-javascript'));
const destPath = path.join(helper.e2eDir, 'node_modules', 'bit-javascript');
fs.removeSync(destPath);
fs.ensureSymlinkSync(bitJavascriptPath, destPath);
});
after(() => {
helper.destroyEnv();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "gulp lint && flow check",
"test": "gulp test",
"postinstall": "bitjs import",
"e2e-test": "gulp e2e-test",
"e2e-test": "mocha --compilers js:babel-core/register ./e2e/**/*.e2e.js",
"build": "babel src specs -d dist",
"watch": "babel watch bin src specs -d dist --source-maps",
"build-debug": "babel src specs -d dist --source-maps",
Expand Down
7 changes: 0 additions & 7 deletions tasks/e2e-test-runner.js

This file was deleted.

0 comments on commit f4a6a25

Please sign in to comment.