Commit Graph

36 Commits

Author SHA1 Message Date
Mike Pennisi 53842533b7 Enforce use of `throw` stmt in early error tests
Previously, test consumers were encouraged to insert a `throw` statement
as the first statement of tests for early errors. This recommendation
made tests harder to consume, and as an optional transformation,
consumers may have ignored it or simply been unaware it was made. By
explicitly including such a `throw` statement, the tests become more
literal, making them easier to consume and more transparent in their
expectations.

Document expectation for all tests for early errors to include an
explicit `throw` statement. Extend linting script to verify that
contributors are automatically notified of violations and to ensure that
future contributions satisfy this expectation.
2017-06-28 11:24:36 -04:00
Rick Waldron c59afa3bd7 CONTRIBUTING.md: Adds 'Source Material' section with 'needs tests' pr list (#1054) 2017-06-12 19:29:58 -03:00
jugglinmike 66bd632bae Lint test `features` tag (#1060)
A recent commit introduced a document that enumerated acceptable values
for the test "features" metadata tag. However, this list was incomplete,
and maintaining it placed extra burden on the project owners.

Restructure the document into a machine-readable format. Add entries for
all previously-omitted values. Add in-line documentation with
recommendations for maintenance of the file. Extend the project's
linting tool to validate tests according to the document's contents.
2017-06-12 18:59:14 -03:00
Mathias Bynens 09f01de87e CONTRIBUTING: Fix typo (#1013) 2017-05-01 13:22:49 -04:00
Leo Balter 666f0e920a
Add assert.throws.early 2017-05-01 12:29:52 -04:00
jugglinmike 74954bfa91 Introduce automated validation for test format (#994)
This script is intended to identify common test file formatting errors
prior to their acceptance into the project. It is designed to support
future extensions for additional validation rules.
2017-05-01 12:04:05 -04:00
Mathias Bynens 5f81c02e3f CONTRIBUTING: Link to the latest spec draft (#978) 2017-04-14 12:19:39 -04:00
jugglinmike bcb7651529 Automate deployment (#546)
Introduce configuration to allow build servers provided by the Travis CI
service to execute the test generation tool and commit the resultant
files to the canonical upstream repository.

Enabling this workflow required additional administrative work:

1. Create an account with TravisCI
2. Install the `travis` command-line utility
3. Create a "deploy key" and an encrypted version using the command
   `./make.py github_deploy_key_enc`
4. Register the deploy key with the project's GitHub account
5. Check the encrypted deploy key to the repository
6. Configure the TravisCI service to automatically build this project
2017-04-10 15:31:19 -04:00
jugglinmike 56fd7712d2 Document test flag: `generated` (#886)
Resolves gh-885
2017-03-06 12:12:42 -05:00
Mike Pennisi ade6d2e384 Remove "NotEarlyError" object
Because expectations regarding error "phase" are now expressed via test
meta-data, the test runner may now enforce this requirement on negative
tests.

Remove the "NotEarlyError" from the project source. This reduces the
amount of domain knowledge required to author tests and lessens the
potential for inconsistencies between tests.
2016-10-19 15:24:22 -04:00
Mike Pennisi 0d4a07ba8c Update documentation 2016-10-19 15:24:21 -04:00
Tim Disney 3707a85705 Fix markdown typo (#763) 2016-09-27 17:05:08 -04:00
Aleksey Shvayka 8fbe992e6e Fix operator precedence (#754)
Unlike PHP, in JavaScript ! has higher precedence than instanceof, thus !smth instanceof TypeError will never (unless @@hasInstance is defined) be true.
2016-09-01 17:50:25 -07:00
Leo Balter 3723e7caeb Merge pull request #545 from bocoup/generation
Introduce test generation tool
2016-04-15 17:56:36 -04:00
Mike Pennisi 3a3ced170e Correct example in contribution guidelines
As written, the example for asserting runtime errors is written with an
early error. Because the error is expected to be reported prior to
program execution, the `assert.throws` function cannot be used to detect
it.

Demonstrate the usage of the helper function with a runtime error.
2016-03-22 09:53:56 -04:00
Leo Balter 5357b1585b Merge pull request #504 from bocoup/explicit-async
Make asynchronous test configuration explicit
2016-03-17 15:28:08 -04:00
Mike Pennisi 74bff6b3d5 Add initial set of generated test sources 2016-03-16 15:29:30 -04:00
Leonardo Balter bf782c8421 s/id/esid
Fixes #477
2016-02-22 09:47:42 -05:00
Mike Pennisi 23d566209a Make asynchronous test configuration explicit
For asynchronous tests, the contract between test file and test runner
is implicit: runners are expected to inspect the source code for
references to a global `$DONE` identifier.

Promote a more explicit contract between test file and test runner by
introducing a new frontmatter "tag", `async`. This brings asynchronous
test configuration in-line with other configuration mechanisms and also
provides a more natural means of test filtering.

The modifications to test files was made programatically using the
`grep` and `sed` utilities:

    $ grep "\$DONE" test/ -r --files-with-match --null | \
        xargs -0 sed -i 's/^\(flags:\s*\)\[/\1[async, /g'
    $ grep "\$DONE" test/ -rl --null | \
        xargs -0 grep -E '^flags:' --files-without-match --null | \
        xargs -0 sed -i 's/^---\*\//flags: [async]\n---*\//'
2016-02-12 13:03:19 -05:00
Mike Pennisi 60afce3636 Update contribution guidelines
It was recently decided to prefer the new `id` tag over the existing
`es5id` and `es6id` tag when authoring tests. Update the contribution
guidelines to reference the new tag.
2016-02-04 15:37:02 -05:00
Gorkem Yakin fbad34959f Replace "id" with "ID" 2016-01-29 09:29:09 -08:00
Leonardo Balter cb754d2450 Document frontmatter's id tag
Fixes #477
2016-01-29 09:24:03 -08:00
Mike Pennisi ab7617dedd Implement `raw` flag
Some tests involving the directive prologue are invalidated by source
text transformations that insert executable code in the beginning of the
script. Implement a `raw` flag that allows these tests to opt-out of
this transformation. Update the relevant tests to use this flag (and
remove references to globals only available when code is injected).

Update the Python runner accordingly:

- Do not run tests marked as "raw" in strict mode
- Reject invalid test configurations

Update the browser runner accordingly:

- Do not modify the script body of tests marked as "raw"
2015-07-07 13:18:55 -04:00
Brian Terlson e4a25da86a Merge pull request #305 from jugglinmike/browser-only-strict
Update browser runner to honor `onlyStrict` flag
2015-06-25 14:44:34 -07:00
Mike Pennisi f424d5f37b Update spec references to use canonical source 2015-06-24 16:36:59 -04:00
Mike Pennisi cb617493d7 Update browser runner to honor `onlyStrict` flag
Unlike the console runner, the browser runner does not modify the
strictness of tests prior to running them. Regardless of a given test's
metadata, it runs every test exactly once, and it never enables strict
mode. This means that tests intended to function in strict mode must
declare the "use strict"; directive prologue in addition to the
`onlyStrict` flag.

For any test that specifies the `onlyStrict` metadata flag, transform
the source code by injecting a "use strict" directive prologue prior to
running the test.
2015-06-18 17:38:33 -04:00
Mike Pennisi b8b462316b Add tests for early errors in module syntax
Introduce the `module` flag to unambiguously identify tests that are
intended to be interpreted as module code.
2015-06-03 13:15:15 -04:00
Mike Pennisi 4e4ea1145b Update contribution guidelines
- Remove trailing white space
- Streamline documentation of test tags
- Do not reference obsolete tags
- Document `features` frontmatter tag
- Document `es6id` frontmatter tag
- Omit unnecessary detail about test262 website generation. This is not
  directly useful to potential test contributors. Implementation details
  like these can be taken for granted by that audience.
- Remove documentation on YAML syntax. Details on YAML may be helpful
  for some new contributors, but this document should not attempt to
  cover the topic (especially not from the description of a specific
  frontmatter entry). Replace with a link to a more comprehensive source
  as this will be more generally useful to those who need it (and less
  obtrusive for those who do not).
- Consolidate information on test helpers
- Document `assert` helpers
- Update instructions for asserting errors. Since the introduction of
  `assert.throws` in gh-22, the preferred means of expressing
  expectations regarding errors has changed. Update the CONTRIBUTING.md
  file to reflect the latest approach. Explain purpose of `throw
  NotEarlyError;` in example test.
- Re-order information on file names. The inconsistency in the project's
  file names should not go unmentioned, but neither should it not
  preceed instructions for the accepted approach to namine tests.
- More clearly document required frontmatter tags. Explicitly list
  `description` as a required frontmatter tag, implicitly identifying
  all other tags as optional.
2015-06-03 11:18:17 -04:00
Domenic Denicola 1d6c0357c2 Update copyright year in sample copyright 2015-02-17 11:54:51 -05:00
Rick Waldron 7ec37d7379 Contributing: updates the Test Case Names section. Closes gh-150. Closes gh-136 2015-02-16 17:39:55 -05:00
Sam Mikes 5b8879b951 document `timeout` and clean up
CONTRIBUTING.md
- document `timeout` tag
- reorder tags in frontmatter doc
- minor cleanups
- minor fixes
- add style note
- reformat flags
- remove discussion of obsolete $INCLUDE
- incorporate line notes from @domenic
- integrate additional comments
- add links back, move arg notes down
- Raise outline level by one

README.md
- link to CONTRIBUTING
2014-08-25 17:00:15 +01:00
smikes 240635c99a CONTRIBUTING.md: minor fixes
Minor fixes: typos, formatting, verb tense&agreement
Add example of short-list `includes: []` and long-list `includes: \n - \n -`
2014-07-31 14:41:08 -06:00
Sam Mikes 23ef85c9a7 CONTRIBUTING: more notes on test writing
Add section on test environment
Add section on custom helpers
describe YAML frontmatter
Fix minor formatting errors
document $INCLUDE as obsolete
Change documentation of negative error
Move test environment and custom helpers down
indent copyright and frontmatter sections
better description of the async calls between a promise
and the functions in its `.then`
Correct Early Error example: don't throw a string

CONSOLE-RUNNER: split runner doc into new file
add troubleshooting section
2014-07-31 20:17:15 +01:00
smikes 99706a2786 CONTRIBUTING: add notes on async
add a table showing which print handle to use when
running async tests through test262.py runner

@anba contributed information about async tests in
SpiderMonkey and JavaScriptCore
2014-07-23 21:55:16 +01:00
Sam Mikes d180b84e01 CONTRIBUTING: document test262.py, async tests
add a section on requirements for using console test runner test262.py

add a section on asynchronous tests

add subsection to authoring guidelines with suggestion for test names
2014-07-21 10:19:06 -06:00
Murat Sutunc 874ddaeb24 Added contributing.md and improved README 2014-07-10 14:53:31 -07:00