I'm fairly new to the Javascript world (coming from Android) so I've been reading up on how to setup Mocha/Jasmine to get my test environment in place. I've noticed a convention of "spec" in reference to test directories, file suffix, suite names, and/or tests/assertions.
Is this specific to testing in Javascript? And what does "spec" actually stand for? Specification, Expectation, or ?
Spec is short for "Specification" as @DavinTryon suggested above. Specification in terms of a test refer to the technical details of a given feature or application which must be fulfilled. The best way to think of this is as the technical specifications for a given unit of code to pass successfully.
Spec files are plain-text files that are used to construct spec strings. They consist of a sequence of directives separated by blank lines. The type of directive is determined by the first non-whitespace character on the line, which can be one of the following: % command. Issues a command to the spec file processor.
In order to run a specific test, you'll need to use the jest command. npm test will not work. To access jest directly on the command line, install it via npm i -g jest-cli or yarn global add jest-cli . Then simply run your specific test with jest bar.
A spec contains one or more expectations that test the state of the code. An expectation in Jasmine is an assertion that is either true or false. A spec with all true expectations is a passing spec. A spec with one or more false expectations is a failing spec.
Spec is short for "Specification" as @DavinTryon suggested above.
Specification in terms of a test refer to the technical details of a given feature or application which must be fulfilled. The best way to think of this is as the technical specifications for a given unit of code to pass successfully. https://en.wikipedia.org/wiki/Unit_testing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With