summaryrefslogtreecommitdiff
path: root/examples/scala-js/TESTING
blob: 7d393a46e73cee2e278b21c7235d106aa78b37a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
This file contains test cases that should be manually executed.

## CLI Distribution

For each major Scala version on a *NIX distro and a Windows distro:

1. Download packaged Scala from scala-lang.org
2. Build Scala.js CLI distribution (e.g. `./assemble-cli.sh 2.10`)
3. Unpack Scala and Scala.js distro
4. Add `bin/` directories of both distributions to path (`export PATH=$PATH:<scala path>/bin:<scala.js path>/bin`)
5. Create a temporary directory and do:

        mkdir bin
        echo 'import scala.scalajs.js.JSApp
          object Foo extends JSApp {

            def main() = {
              println(s"asdf ${1 + 1}")
              new A
            }

            class A
          }' > foo.scala
        scalajsc -d bin foo.scala

        scalajsp bin/Foo$.sjsir
        # Verify output
        scalajsp bin/Foo\$A.sjsir
        # Verify output

        scalajsld -o test.js bin
        # Verify output

        echo "Foo().main()" >> test.js
        node test.js # Or your favorite thing to run JS

        # Expect "asdf 2"

## HTML-Runners

The following HTML-runners/testers must be manually tested:

    examples/helloworld/helloworld-{2.10|2.11}{|-fastopt}.html
    examples/reversi/reversi-{2.10|2.11}{|-fastopt}.html
    examples/testing/testing-{2.10|2.11}{|-fastopt}.html
    test-suite/scalajs-test-suite-{2.10|2.11}{|-fastopt}.html

## Sourcemaps

To test source maps, do the following on:

    examples/reversi/reversi-{2.10|2.11}{|-fastopt}.html

1. Open the respective file in Google Chrome
2. Set a break-point in the HTML launcher on the `new Reversi` statement
3. Step over calls to jQuery into constructor
4. Step into the call to `Array.tabulate` and verify that source maps
   to Scala standard library sources work (should point to GitHub)
5. Single step through constructor, until you reach `buildUI()`
6. Step into `buildUI()`


## When releasing only

Once all tests pass, tag the revision and verify that source maps to
Scala.js sources work correctly (should point to GitHub), following
the steps described in the section Sourcemaps.