UNPKG

2.46 kBMarkdownView Raw
1## Environment
2
3Requires:
4
5- [Yarn](https://yarnpkg.com/)
6- >= Node 10.18.1
7
8## Building
9
10The 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
12To perform a build, use the `build` script:
13
14```
15yarn build
16```
17
18## Running Tests
19
20Unit tests can be executed using [Jest](https://jestjs.io/) by issuing the following command:
21
22```
23yarn test
24```
25
26To interactively perform tests using Jest's `watch` mode, use:
27
28```
29yarn test:watch
30```
31
32End-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:
36yarn test:e2e
37
38# Watch mode using Chrome desktop browser, in watch mode:
39yarn test:e2e:watch
40```
41
42## The SDK Playground
43
44To test the SDK manually and play around with the various options and features, you can invoke the Playground by using:
45
46```
47yarn start
48```
49
50Next, 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
52This 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
56If 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
58You can then use another SPA app to log in using this tenant that has this customized version of the Lock template.
59
60You 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
62Lock can already support HTTPS just by running `yarn start` if you have `mkcert` installed.
63
64To install `mkcert`:
65
66```
67brew install mkcert
68
69brew install nss # if you use Firefox
70
71mkcert install
72
73# Serve lock
74yarn start
75```
76
77Once Lock has started, use another SPA app to log in using a tenant with the template customized as above.
78
79If you don't have `mkcert`, HTTPS will still be used but it will be untrusted.
\No newline at end of file