Skip to content

hardhat test doesn't run any tests? #3117

@JimLynchCodes

Description

@JimLynchCodes

Hi, when I point directly to my file with tests in it I get the output 0 passing

const { ethers } = require("hardhat");
const { use, expect } = require("chai");
const { solidity } = require("ethereum-waffle");

use(solidity);

describe("APPLE", async function () {
  let apple;

  const [owner, user1, user2] = await ethers.getSigners();

  beforeEach(async () => {
    const AppleContract = await ethers.getContractFactory('APPLE');
    apple = await AppleContract.deploy()
  })

  describe("init", function () {

    it('initializes everyone owning zero apples', async () => {

      expect(await apple.balanceOf(owner.address)).to.equal(0);
      expect(await apple.balanceOf(user1.address)).to.equal(0);
      expect(await apple.balanceOf(user2.address)).to.equal(0);

    })

    it('initializes all nutrition scores to zero', async () => {

      expect(await apple.get_nutrition_score(owner.address)).to.equal(0);
      expect(await apple.get_nutrition_score(user1.address)).to.equal(0);
      expect(await apple.get_nutrition_score(user2.address)).to.equal(0);

    })

    it('initializes total supply of apples to zero (none minted up front)', async () => {

      expect(await apple.totalSupply()).to.equal(0);

    })

  });

  describe('minting apple', () => {

    it('can\'t be called by owner or user addresses', async () => {

      await expect(apple.mint(owner.address, 1)).to.be.revertedWith('Only the TREE contract can call this function');

    })

    describe('called by TREE contract', () => {

      it('mints apple to the specified user', () => {
        // TODO
      })

    })

  })


});
 yarn test ./test/APPLE.test.js

Why does it not see any of my tests???

Screen Shot 2022-09-02 at 2 17 14 AM

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions