Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracking: format test names #3754

Closed
36 of 37 tasks
timreichen opened this issue Oct 31, 2023 · 7 comments · Fixed by #4585
Closed
36 of 37 tasks

tracking: format test names #3754

timreichen opened this issue Oct 31, 2023 · 7 comments · Fixed by #4585
Labels
good first issue Good for newcomers

Comments

@timreichen
Copy link
Contributor

timreichen commented Oct 31, 2023

Ref: #2553 (comment)

This issue tracks the implementation progress of adapting the following format for test names in each sub-module:

<symbol>() <description> // E.g. ensureDir() creates the directory if it doesn't exist
  • archive
  • assert
  • async
  • bytes
  • cli
  • collections
  • console
  • crypto
  • csv
  • datetime
  • dotenv
  • encoding
  • expect
  • flags
  • fmt
  • front_matter
  • fs
  • html
  • http
  • io
  • json
  • jsonc
  • log
  • media_types
  • msgpack
  • path
  • regexp
  • semver
  • streams
  • testing
  • text
  • toml
  • ulid
  • url
  • uuid
  • webgpu
  • yaml
@JakeAve
Copy link
Contributor

JakeAve commented Nov 22, 2023

I'm working on fs - should be done tomorrow

@scarf005
Copy link
Contributor

scarf005 commented Dec 7, 2023

@iuioiua
Copy link
Contributor

iuioiua commented Dec 7, 2023

Ah, yes. We do need to add something in the contributing guidelines. A PR would be welcome!

@syhol
Copy link
Contributor

syhol commented Dec 18, 2023

Is there a way to make the linter enforce this?

@syhol
Copy link
Contributor

syhol commented Dec 18, 2023

Would it be worth using the bdd.ts describe blocks to define the subject under test?

Deno.test({
  name: "[std/datetime] isLeap",
  fn() {
    assert(isLeap(1992));
    assert(isLeap(2000));
    assert(!isLeap(2003));
    assert(!isLeap(2007));
    assert(!isLeap(new Date("1970-01-02")));
    assert(isLeap(new Date("1972-01-02")));
    assert(isLeap(new Date("2000-01-02")));
    assert(!isLeap(new Date("2100-01-02")));
  },
});

to

import { describe, it } from "../testing/bdd.ts";

describe("isLeap()", () => {
  it("identifies leap years for numbers", () => {
    assert(isLeap(1992));
    assert(isLeap(2000));
    assert(!isLeap(2003));
    assert(!isLeap(2007));
  });

  it("identifies leap years for Date instances", () => {
    assert(!isLeap(new Date("1970-01-02")));
    assert(isLeap(new Date("1972-01-02")));
    assert(isLeap(new Date("2000-01-02")));
    assert(!isLeap(new Date("2100-01-02")));
  });
});

It forces the format you're after: Subject under test and description of desired behaviour

The big downside is that you loose the test integration in vscode:
image

@iuioiua
Copy link
Contributor

iuioiua commented Dec 18, 2023

docs: unified test names

I don't think so.

Would it be worth using the bdd.ts describe blocks to define the subject under test?

The current approach of using std/assert with Deno.test() (and steps, if needed) already works fine.

javihernant added a commit to javihernant/deno_std that referenced this issue Feb 28, 2024
javihernant added a commit to javihernant/deno_std that referenced this issue Mar 4, 2024
javihernant added a commit to javihernant/deno_std that referenced this issue Mar 5, 2024
iuioiua added a commit that referenced this issue Mar 14, 2024
* refactor(io): format test names

ref #3754

* Update io/buffer_test.ts

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
@iuioiua
Copy link
Contributor

iuioiua commented Apr 10, 2024

For anyone wanting to contribute, only std/testing remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants