Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 42 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,58 @@ on:
- master
- 'v*'
pull_request: {}
workflow_dispatch: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
cancel-in-progress: true

# Least-privilege default; no job here needs to write anything back to the repo.
permissions:
contents: read

jobs:
test:
name: Tests
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v3
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version: 18.x
- uses: pnpm/action-setup@v2
node-version: 22
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- run: pnpm lint

test:
name: Tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
# Integration tests build real Ember apps and run them in a browser;
# they run one at a time (see vitest.config.mjs) so parallel test
# runs don't starve each other's builds. Generous headroom accounts
# for that plus CI runners being slower than a dev machine.
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
node-version: ['22', '24', '26']

steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
version: 9
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- run: pnpm lint:js
- name: Build
run: pnpm build
working-directory: packages/ember-cli-code-coverage
- run: pnpm test
- name: Run Tests
run: pnpm test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ node_modules
# misc
npm-debug.log*
yarn-error.log
# unanchored so it covers every workspace package, not just the root
.eslintcache

# ember-try
.node_modules.ember-try/
Expand All @@ -15,4 +17,4 @@ yarn-error.log
.DS_Store
coverage
dist
.build
.build
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# generated
dist/
coverage/
pnpm-lock.yaml
CHANGELOG.md

# vitest snapshots are written by vitest, not by hand
test-packages/__snapshots__/

# fixture apps carry their own (frozen) formatting
test-packages/*/
9 changes: 0 additions & 9 deletions .prettierrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
singleQuote: true,
};
2 changes: 0 additions & 2 deletions .tool-versions

This file was deleted.

48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,36 @@



## v2.0.0-beta.2 (2021-10-28)

#### :boom: Breaking Change
* `ember-cli-code-coverage`
* [#332](https://github.com/kategengler/ember-cli-code-coverage/pull/332) Move `sendCoverage` to be added by the host in `QUnit.done` ([@thoov](https://github.com/thoov))

#### :rocket: Enhancement
* `ember-cli-code-coverage`
* [#333](https://github.com/kategengler/ember-cli-code-coverage/pull/333) Migrate to using native `fetch` instead of XMLHttpRequest ([@rwjblue](https://github.com/rwjblue))

#### Committers: 2
- Robert Jackson ([@rwjblue](https://github.com/rwjblue))
- Travis Hoover ([@thoov](https://github.com/thoov))


## v2.0.0-beta.1 (2021-10-26)

#### :boom: Breaking Change
* `ember-cli-code-coverage`
* [#327](https://github.com/kategengler/ember-cli-code-coverage/pull/327) Re-architect plugin loading and asset detection logic (add Embroider support) ([@thoov](https://github.com/thoov))
* [#325](https://github.com/kategengler/ember-cli-code-coverage/pull/325) Run ember-cli-upgrade to v3.28.1 ([@thoov](https://github.com/thoov))

#### :house: Internal
* `ember-cli-code-coverage`
* [#326](https://github.com/kategengler/ember-cli-code-coverage/pull/326) Use volta-cli for node and yarn versioning ([@thoov](https://github.com/thoov))

#### Committers: 1
- Travis Hoover ([@thoov](https://github.com/thoov))


## v1.0.3 (2021-04-26)

#### :bug: Bug Fix
Expand Down Expand Up @@ -224,6 +254,24 @@
- abishek-srinivasan ([@abishek-srinivasan](https://github.com/abishek-srinivasan))


## v1.0.0-beta.9 (2020-02-22)

#### :rocket: Enhancement
* [#223](https://github.com/kategengler/ember-cli-code-coverage/pull/223) Support Typescript / ember-cli-typescript ([@lifeart](https://github.com/lifeart))

#### :bug: Bug Fix
* [#236](https://github.com/kategengler/ember-cli-code-coverage/pull/236) Ensure coverage collection accounts for addons with a custom `moduleName` implementation ([@axelerate](https://github.com/axelerate))

#### :house: Internal
* [#237](https://github.com/kategengler/ember-cli-code-coverage/pull/237) Merge pull request #237 from kategengler/rwjblue-patch-1 ([@rwjblue](https://github.com/rwjblue))

#### Committers: 4
- Alex Kanunnikov ([@lifeart](https://github.com/lifeart))
- Axel Hadfeg ([@axelerate](https://github.com/axelerate))
- Robert Jackson ([@rwjblue](https://github.com/rwjblue))
- [@ventuno](https://github.com/ventuno)


## v1.0.0-beta.8 (2019-01-02)

#### :bug: Bug Fix
Expand Down
106 changes: 94 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,106 @@

## Installation

* `git clone <repository-url>`
* `cd my-addon`
* `npm install`
```bash
git clone <repository-url>
cd ember-cli-code-coverage
pnpm install
```

## Project Structure

This is a **pnpm workspace monorepo** with the following layout:

- `packages/ember-cli-code-coverage/` — the addon
- `test-packages/` — tests and fixture apps

Inside the addon, the Node-side code is TypeScript compiled to `dist/`:

| Path | Runs in | Purpose |
| -------------- | ------- | ------------------------------------------------------------- |
| `src/core/` | Node | Shared pipeline: config, path mapping, source maps, reports |
| `src/babel/` | Node | Istanbul instrumentation for classic and Embroider builds |
| `src/vite/` | Node | Instrumentation and dev-server endpoint for Vite builds |
| `src/testem/` | Node | `/write-coverage` endpoint for `ember test` and `ember serve` |
| `src/glimmer/` | Node | AST plugin that instruments `.hbs` templates |
| `src/merge/` | Node | `ember coverage-merge` for parallel runs |
| `src/browser/` | Browser | `sendCoverage`, `forceModulesToBeLoaded` |
| `runtime/` | Browser | Template coverage helpers, authored as ESM and shipped as-is |
| `_app_/` | Browser | App-tree re-exports that make those helpers resolvable |

`runtime/` and `_app_/` deliberately skip the TypeScript build: they are
browser modules pulled into a consuming app's tree, so they must stay ESM.
Every path listed in `ember-addon.app-js` also has to appear in `exports`,
or Embroider refuses to resolve it.

## Building

```bash
cd packages/ember-cli-code-coverage
pnpm build # Compile TypeScript to dist/
```

## Linting

* `npm run lint`
* `npm run lint:fix`
```bash
pnpm lint # Run ESLint across the workspace
pnpm lint:fix # Auto-fix lint issues
```

## Running Tests

Tests use [Vitest](https://vitest.dev/) and run from the workspace root:

```bash
pnpm test # Run the full test suite
```

Individual test files can be targeted:

```bash
pnpm vitest test-packages/my-app-test.mjs
```

There are two kinds of test. The fast ones exercise a plugin directly and
finish in milliseconds:

```bash
pnpm vitest test-packages/template-coverage-plugin-test.mjs
pnpm vitest test-packages/template-coverage-runtime-test.mjs
pnpm vitest test-packages/gjs-gts-ignore-template-plugin-test.mjs
```

The rest copy a fixture app to a temp directory and run a real build, which
takes minutes each. Each fixture covers one build shape:

| Fixture | Covers |
| --------------------------------------- | -------------------------------------------------------------- |
| `my-app` | Classic build, parallel runs, custom excludes, prebuilt output |
| `my-embroider-app` | Embroider build |
| `my-embroider-app-template-imports` | Embroider with `.gjs` template imports |
| `my-app-template-coverage` | Classic build with `templateCoverage` on |
| `my-vite-app` | Vite build, plus the build-time coverage baseline |
| `my-v1-addon`, `scoped-v1-addon` | v1 addon namespaces, including scoped |
| `my-v2-addon-gjs-gts` | v2 addon with `.gjs`/`.gts` sources |
| `my-app-with-in-repo-addon` | In-repo addon paths and `modifyAssetLocation` |
| `my-app-with-custom-path-in-repo-addon` | In-repo addon in a non-standard directory |
| `my-app-with-in-repo-engine` | In-repo engine |

> **Note:** Integration tests create temporary fixture projects, install
> dependencies, and run `ember test`. They have a 10-minute timeout and
> require a working internet connection.

## Running tests
### Adding a fixture

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions
Fixture apps are workspace members, so a new one needs `pnpm install` at the
root before its test can run. Depend on the addon with `workspace:*`, and
wire it up the way a real consumer would — the point of these tests is that
the documented setup works.

## Running the dummy application
## Development Workflow

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).
1. Make changes in `packages/ember-cli-code-coverage/src/`
2. Run `pnpm build` in the package directory
3. Run tests from the workspace root: `pnpm test`

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
Loading