Skip to content

Commit cd4d8ae

Browse files
committed
Clean up testing a bit, add COC and CONTRIBUTING
1 parent af183da commit cd4d8ae

File tree

36 files changed

+274
-833
lines changed

36 files changed

+274
-833
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ lib/extensions
7171
# Autogenerated content
7272
lib/grammars
7373
lib/themes
74-
test/integration/report.html
74+
test/integration/viewer/report.html

CODE_OF_CONDUCT.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment for our community include:
12+
13+
* Demonstrating empathy and kindness toward other people
14+
* Being respectful of differing opinions, viewpoints, and experiences
15+
* Giving and gracefully accepting constructive feedback
16+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17+
* Focusing on what is best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior include:
20+
21+
* The use of sexualized language or imagery, and sexual attention or
22+
advances of any kind
23+
* Trolling, insulting or derogatory comments, and personal or political attacks
24+
* Public or private harassment
25+
* Publishing others' private information, such as a physical or email
26+
address, without their explicit permission
27+
* Other conduct which could reasonably be considered inappropriate in a
28+
professional setting
29+
30+
## Enforcement Responsibilities
31+
32+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33+
34+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35+
36+
## Scope
37+
38+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39+
40+
## Enforcement
41+
42+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at coc@wheream.io. All complaints will be reviewed and investigated promptly and fairly.
43+
44+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45+
46+
## Enforcement Guidelines
47+
48+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49+
50+
### 1. Correction
51+
52+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53+
54+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55+
56+
### 2. Warning
57+
58+
**Community Impact**: A violation through a single incident or series of actions.
59+
60+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61+
62+
### 3. Temporary Ban
63+
64+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65+
66+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67+
68+
### 4. Permanent Ban
69+
70+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71+
72+
**Consequence**: A permanent ban from any sort of public interaction within the community.
73+
74+
## Attribution
75+
76+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78+
79+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80+
81+
[homepage]: https://www.contributor-covenant.org
82+
83+
For answers to common questions about this code of conduct, see the FAQ at
84+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Contributing
2+
3+
## Code of Conduct
4+
5+
Please note that this project is released with a Contributor [Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
6+
7+
## Open an issue
8+
9+
PRs introducing new ideas are always welcome, but might be declined if opened without any prior discussion. To avoid wasted work, it’s always best to [open an issue](https://github.com/andrewbranch/gatsby-remark-vscode/issues/new) first.
10+
11+
## Local development setup
12+
13+
Prerequisites: development is supported on the current [Node LTS](https://nodejs.org/).
14+
15+
1. Fork and clone the repo.
16+
2. Run `npm install`
17+
18+
Running `npm install` should automatically initialize or update the [vscode](./vscode) submodule, generate `src/graphql/schema.d.ts`, and populate [`lib/grammars`](lib/grammars) and [`lib/themes`](lib/themes). If any of these things are missing, you’ll errors when you try to run things later. You can rerun these steps with `npm run build`.
19+
20+
## Tests
21+
22+
To run tests, run `npm test`. You can use Jest CLI options after a `--` separator. For example, to run just the test named “code-fence-meta”, use `npm test -- -t code-fence-meta`.
23+
24+
Most tests are either Jest snapshot tests or HTML baseline tests against a known-good source ([`test/integration/cases/baselines`](test/integration/cases/baselines)). To update the snapshots and baselines, run `npm test -- -u`.
25+
26+
Most new tests can be integration tests. To write one, create a new folder in `test/integration/cases`, then put a Markdown file named `test.md` inside. If you want to run the plugin with custom options, place an `options.js` file whose `module.exports` is the options object to be passed to the plugin. Then, when you next run `npm test`, the baseline will be created and opened in a browser so you can view the resulting HTML. If it looks right, commit it and you’re done. If it looks wrong, you can overwrite the bad baseline by running `npm test -- -u -t name-of-test` after you’ve made changes to fix your code.
27+
28+
## Debugging
29+
30+
VS Code launch scripts have been provided, so you can debug the tests or the [example site](examples/example-site) by using VS Code’s debug menu. Otherwise, you can always run `node --inspect-brk node_modules/.bin/jest --runInBand` and attach with whatever debugger you like.
31+
32+
## Get ready for a PR
33+
34+
When you’ve made changes you’re happy with, ensure that you have
35+
36+
- Added a test if appropriate,
37+
- Formatted your changes through Prettier with `npm run format`,
38+
- Maintained good JSDoc type annotations to the best of your ability.
39+
40+
This project is written in plain JavaScript, but uses TypeScript to type-check via JSDoc annotations. After tests, type checking runs (and can be run alone with `npm run check`). If types are new to you, or you have trouble getting type checking to pass, that’s ok! I’ll help you in your PR if necessary. Type checking is a great way to catch errors early, but I don’t want it to be an impediment for anyone’s contribution.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ If you’re updating from v1.x.x to v2.x.x, see [MIGRATING.md](./MIGRATING.md).
2828
- [Line highlighting](#line-highlighting)
2929
- [Using different themes for different code fences](#using-different-themes-for-different-code-fences)
3030
- [Arbitrary code fence options](#arbitrary-code-fence-options)
31+
- [Contributing](#contributing)
3132

3233
## Why gatsby-remark-vscode?
3334

@@ -400,6 +401,12 @@ Line numbers and ranges aren’t the only things you can pass as options on your
400401
}
401402
```
402403

404+
## Contributing
405+
406+
Please note that this project is released with a Contributor [Code of Conduct](./CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
407+
408+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development instructions.
409+
403410
[embedded-others]: https://user-images.githubusercontent.com/3277153/56853797-5debe780-68c8-11e9-91b2-aa651e87a675.png
404411
[embedded-own]: https://user-images.githubusercontent.com/3277153/56853798-5e847e00-68c8-11e9-9eb6-061aa16756ec.png
405412
[typescript-others]: https://user-images.githubusercontent.com/3277153/56853804-5f1d1480-68c8-11e9-965a-bc0adc0e5643.png

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
"description": "Gatsby plugin to provide VS Code’s syntax highlighting to Markdown code fences",
55
"main": "index.js",
66
"scripts": {
7+
"prepare": "npm run build",
78
"build": "node scripts/index.js",
89
"prebuild": "git submodule update --init",
910
"check": "tsc -p .",
1011
"test": "jest",
11-
"test:update": "jest --runInBand -u",
12-
"pretest": "npm run check && npm run build && prettier --check 'src/**/*.js'",
12+
"test:update": "jest -u",
13+
"posttest": "prettier --check 'src/**/*.js' && npm run check",
1314
"prepublishOnly": "npm test",
1415
"format": "prettier --write 'src/**/*.js'"
1516
},
@@ -67,6 +68,7 @@
6768
"vscode-textmate": "4.2.2"
6869
},
6970
"jest": {
71+
"globalSetup": "<rootDir>/test/setup.js",
7072
"coveragePathIgnorePatterns": [
7173
"lib"
7274
],
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/integration/cases/highlight-directive-comments.expected.html renamed to test/integration/baselines/highlight-directive-comments.html

File renamed without changes.

0 commit comments

Comments
 (0)