2016-05-18 15:10:55 +03:00
# Ghost-Admin
2022-08-03 22:16:04 +03:00
This is the home of the Ember.js-based Admin app that ships with [Ghost ](https://github.com/tryghost/ghost ).
2016-05-18 15:10:55 +03:00
2024-07-08 19:57:52 +03:00
## Test
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
### Running tests in the browser
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
Run all tests in the browser by running `yarn dev` in the Ghost monorepo and visiting http://localhost:4200/tests. The code is hotloaded on change and you can filter which tests to run.
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
[Testing public documentation ](https://ghost.notion.site/Testing-Ember-560cec6700fc4d37a58b3ba9febb4b4b )
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
---
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
Tip: You can use `await this.pauseTest()` in your tests to temporarily pause the execution of browser tests. Use the browser console to inspect and debug the DOM, then resume tests by running `resumeTest()` directly in the browser console ([docs](https://guides.emberjs.com/v3.28.0/testing/testing-application/#toc_debugging-your-tests))
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
### Running tests in the CLI
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
To build and run tests in the CLI, you can use:
2022-06-02 11:38:51 +03:00
```bash
2024-07-08 19:57:52 +03:00
TZ=UTC yarn test
2022-06-02 11:38:51 +03:00
```
2024-07-08 19:57:52 +03:00
_Note the `TZ=UTC` environment variable which is currently required to get tests working if your system timezone doesn't match UTC._
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
---
2022-06-02 11:38:51 +03:00
2024-07-08 19:57:52 +03:00
However, this is very slow when writing tests, as it requires the app to be rebuilt on every change. Instead, create a separate watching build with:
2022-06-02 11:38:51 +03:00
```bash
2024-07-08 19:57:52 +03:00
yarn build --environment=test -w -o="dist-test"
2022-06-02 11:38:51 +03:00
```
2024-07-08 19:57:52 +03:00
Then run tests with:
2022-06-02 11:38:51 +03:00
```bash
2024-07-08 19:57:52 +03:00
TZ=UTC yarn test 1 --reporter dot --path="dist-test"
2022-06-02 11:38:51 +03:00
```
2024-07-08 19:57:52 +03:00
The `--reporter dot` shows a dot (`.`) for every successful test, and `F` for every failed test. It renders the output of the failed tests only.
---
2022-06-02 11:38:51 +03:00
To run a specific test file:
```bash
2024-07-08 19:57:52 +03:00
TZ=UTC yarn test 1 --reporter dot --path="dist-test" -mp=tests/unit/helpers/gh-count-characters-test.js
2022-06-02 11:38:51 +03:00
```
2024-07-08 19:57:52 +03:00
---
2022-06-02 11:38:51 +03:00
To have a full list of the available options, run
```bash
ember exam --help
```
2017-01-04 13:18:21 +03:00
# Copyright & License
2024-07-08 19:57:52 +03:00
Copyright (c) 2013-2024 Ghost Foundation - Released under the [MIT license ](LICENSE ). Ghost and the Ghost Logo are trademarks of Ghost Foundation Ltd. Please see our [trademark policy ](https://ghost.org/trademark/ ) for info on acceptable usage.