Skip to content

Commit 9a6371c

Browse files
authored
Add a style guide for writing new specs (#1363)
I've tried to capture the best practices I've come up with while writing tests in the HRX format, mixed with best practices from other testing traditions and a few rules that mostly serve to just establish a consistent style.
1 parent ad83303 commit 9a6371c

File tree

2 files changed

+1339
-27
lines changed

2 files changed

+1339
-27
lines changed

README.md

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* [`:todo`](#todo)
1414
* [`:warning_todo`](#warning_todo)
1515
* [`:ignore_for`](#ignore_for)
16-
* [Organization](#organization)
16+
* [Spec Style](#spec-style)
1717
* [Interactive Mode](#interactive-mode)
1818

1919
[Sass]: https://sass-lang.com
@@ -247,34 +247,13 @@ implementations have dropped support for.
247247

248248
[which is deprecated]: http://sass.logdown.com/posts/7081811
249249

250-
## Organization
250+
## Spec Style
251251

252-
All specs should go in the `spec/` directory. Beyond that, it gets messy. The
253-
specs in this repo accumulated haphazardly over the years from contributions
252+
The specs in this repo accumulated haphazardly over the years from contributions
254253
from many different people, so there's not currently much by way of unified
255-
organizational principles. In general, though, **specs should be organized by
256-
what part of the language they're testing**.
257-
258-
In addition, the following conventions should be followed for new specs when
259-
applicable:
260-
261-
* Specs for plain CSS features, including CSS at-rules like `@media` and CSS
262-
selector syntax, go in `spec/css/`.
263-
264-
* Specs for built-in functions go in `spec/core_functions/`, under directories
265-
whose names correspond to the modules in [the module system proposal][]. For
266-
example, specs for the `rgb()` function go in
267-
`spec/core_functions/color/rgb/`.
268-
269-
[the module system proposal]: https://github.com/sass/language/blob/master/accepted/module-system.md#built-in-modules-1
270-
271-
* Specs for Sass's at-rules like `@extend` and `@import` go in `spec/directives/`.
272-
273-
* Specs for SassScript value types go in `spec/values/`.
274-
275-
All directory names should be lowercase and underscore-separated. All error
276-
specs for a given feature should go in an `errors/` directory under that
277-
feature's directory.
254+
style or organization. However, all new specs should follow the [style
255+
guide](STYLE_GUIDE.md), and old specs should be migrated to be style-guide
256+
compliant whenever possible.
278257

279258
## Interactive Mode
280259

0 commit comments

Comments
 (0)