1 | ## Environment
|
2 |
|
3 | Requires:
|
4 |
|
5 | - [Yarn](https://yarnpkg.com/)
|
6 | - >= Node 10.18.1
|
7 |
|
8 | ## Building
|
9 |
|
10 | The SDK uses [Webpack](https://webpack.js.org/) to compile all JavaScript assets into a set of output modules to be consumed by other module builders such as Webpack and [Rollup](https://rollupjs.org/guide/en/), or directly into and HTML file via the CDN.
|
11 |
|
12 | To perform a build, use the `build` script:
|
13 |
|
14 | ```
|
15 | yarn build
|
16 | ```
|
17 |
|
18 | ## Running Tests
|
19 |
|
20 | Unit tests can be executed using [Jest](https://jestjs.io/) by issuing the following command:
|
21 |
|
22 | ```
|
23 | yarn test
|
24 | ```
|
25 |
|
26 | To interactively perform tests using Jest's `watch` mode, use:
|
27 |
|
28 | ```
|
29 | yarn test:watch
|
30 | ```
|
31 |
|
32 | End-to-end tests can be executed locally using [Karma](https://karma-runner.github.io/), in both watch and CLI mode:
|
33 |
|
34 | ```
|
35 | # CLI mode using Chrome Headless browser:
|
36 | yarn test:e2e
|
37 |
|
38 | # Watch mode using Chrome desktop browser, in watch mode:
|
39 | yarn test:e2e:watch
|
40 | ```
|
41 |
|
42 | ## The SDK Playground
|
43 |
|
44 | To test the SDK manually and play around with the various options and features, you can invoke the Playground by using:
|
45 |
|
46 | ```
|
47 | yarn start
|
48 | ```
|
49 |
|
50 | Next, open `https://localhost:3000/support`, which will display a simple web app that allows you to interact with Auth0 to test functionality. The HTML template in `support/index.html` can be modified to test various different pieces of functionality.
|
51 |
|
52 | This is preconfigured with an Auth0 tenant and client ID but you may change this to your own for testing.
|
53 |
|
54 | ## Testing Lock locally through the Universal Login Page
|
55 |
|
56 | If you need to test a local build of Lock, but hosted on the ULP, you can do this by modifying the ULP template for a tenant so that the script for Lock points to the locally-served instance at `https://localhost:3000/build/lock.js`.
|
57 |
|
58 | You can then use another SPA app to log in using this tenant that has this customized version of the Lock template.
|
59 |
|
60 | You may need to run Lock using HTTPS with a valid certificate if you want to do this testing in Safari, as Safari will not load mixed content pages, and will also not load HTTPS with untrusted testing certificates.
|
61 |
|
62 | Lock can already support HTTPS just by running `yarn start` if you have `mkcert` installed.
|
63 |
|
64 | To install `mkcert`:
|
65 |
|
66 | ```
|
67 | brew install mkcert
|
68 |
|
69 | brew install nss # if you use Firefox
|
70 |
|
71 | mkcert install
|
72 |
|
73 | # Serve lock
|
74 | yarn start
|
75 | ```
|
76 |
|
77 | Once Lock has started, use another SPA app to log in using a tenant with the template customized as above.
|
78 |
|
79 | If you don't have `mkcert`, HTTPS will still be used but it will be untrusted. |
\ | No newline at end of file |