This repository has been archived by the owner. It is now read-only.

"sources" key in config file isn't parsed correctly when extending base configuration #222

Closed
singles opened this Issue Jul 11, 2012 · 5 comments

Comments

Projects
None yet
3 participants
@singles

singles commented Jul 11, 2012

Imagine file structure like this

test
    buster.js
    some-test.js
target
    some.js

and buster.js contains:

var config = module.exports;

config["Tests"] = {
    rootPath: '../',
    tests: ["test/some-test.js"]
};

config["Browser tests"] = {
    extends: "Tests",
    environment: "browser",
    sources: ["target/some.js"]
};

config["Node tests"] = {
    extends: "Tests",
    environment: "node"
};

which is coppied from docs.

Problem is, that when you run buster-static (from . or test - doesn't matter), files from sources are not sent to the browser. You have to move sources key into base config, which is Tests in that case and then it works.

If it's correct behaviour, then docs should be updated to reflect that.

PS. I did not post it into buster-configuration, because there's no issue tab there.

EDIT: Versions:

npm list | grep buster
├─┬ buster@0.6.2 
│ ├── buster-assertions@0.10.3 
│ ├─┬ buster-autotest@0.2.0 
│ │ ├─┬ buster-glob@0.3.2 
│ ├── buster-core@0.6.3 
│ ├── buster-evented-logger@0.4.4 
│ ├── buster-format@0.5.5 
│ ├─┬ buster-server-cli@0.1.0 
│ │ ├─┬ buster-capture-server@0.5.1 
│ │ ├─┬ buster-cli@0.5.0 
│ │ │ ├─┬ buster-configuration@0.5.1 
│ │ │ ├── buster-terminal@0.4.1 
│ │ ├── buster-user-agent-parser@0.3.1 
│ │   ├─┬ buster-glob@0.3.2 
│ ├── buster-sinon@0.6.0 
│ ├─┬ buster-static@0.5.0 
│ │ ├─┬ buster-cli@0.5.0 
│ │ │ ├─┬ buster-configuration@0.5.1 
│ │ │ ├── buster-terminal@0.4.1 
│ │   ├─┬ buster-glob@0.3.2 
│ ├─┬ buster-syntax@0.4.2 
│ ├─┬ buster-test@0.6.1 
│ │ └── buster-terminal@0.4.1 
│ ├─┬ buster-test-cli@0.6.2 
│ │ ├── buster-analyzer@0.3.1 
│ │ ├─┬ buster-capture-server@0.5.1 
│ │ │   ├─┬ buster-glob@0.3.2 
│ │ ├─┬ buster-cli@0.5.0 
│ │ │ ├─┬ buster-configuration@0.5.1 
│ │ │ │   ├── buster-glob@0.3.2 
│ │ ├── buster-terminal@0.4.1 
│ │ ├── buster-user-agent-parser@0.3.1 
@cjohansen

This comment has been minimized.

Member

cjohansen commented Jul 12, 2012

I suspect the problem is the rootPath setting. Does it work if you have the same rootPath in both groups?

@singles

This comment has been minimized.

singles commented Jul 12, 2012

Replaced above config with this one:

var config = module.exports;

config["Tests"] = {
    tests: ["test/some-test.js"]
};

config["Browser tests"] = {
    extends: "Tests",
    rootPath: '../',
    environment: "browser",
    sources: ["target/some.js"]
};

config["Node tests"] = {
    extends: "Tests",
    rootPath: '../',
    environment: "node"
};

node tests are ok. browser tests by buster-static don't even start server. No output, just nothing.

@ghost ghost assigned cjohansen Jul 15, 2012

@dwittner

This comment has been minimized.

Member

dwittner commented Aug 30, 2013

The cause of the issue is, that Buster.JS sets the environment to browser, if not set explicitly. Thus there are in fact two configurations for the browser and one for node. If you run the tests via buster-test, you can see 2 runs for browser. The first run fails, because the source file isn't loaded for the "Test" configuration. The second run succeeds.

@dwittner

This comment has been minimized.

Member

dwittner commented Aug 30, 2013

Related to issue #364.

@dwittner

This comment has been minimized.

Member

dwittner commented Sep 5, 2013

The bevaviour of Buster.JS will be changed. From now on the environment won't be set to browser, if not set explicitly, because that seems not to be very intuitive, not that what the user expects.
Instead if the environment is missing for a group and it is not extended by another group, the group will be ignored and the user gets a warning about that fact.

@dwittner dwittner closed this Sep 5, 2013

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.